﻿using System;
using System.ComponentModel;
using CthulhuDomain.GameEntities;
using CthulhuDomain.Services;
using Microsoft.Pex.Framework.Validation;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Pex.Framework;
using Microsoft.Xna.Framework.Input;
using CthulhuDomain;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using System.IO;

namespace Invaders.Test
{
  //[TestClass]
  //public partial class InvadersFixture
  //{
  //  private static ContentManager contentManager;

  //  public TestContext TestContext { get; set; }

  //  #region Additional test attributes
  //  //
  //  // You can use the following additional attributes as you write your tests:
  //  //

  //  //
  //  // Use ClassCleanup to run code after all tests in a class have run
    
  //  //
  //  // Use TestInitialize to run code before running each test 
  //  // [TestInitialize()]
  //  // public void MyTestInitialize() { }
  //  //
  //  // Use TestCleanup to run code after each test has run
  //  // [TestCleanup()]
  //  // public void MyTestCleanup() { }
  //  //
  //  #endregion

  //  [PexMethod]
  //  [PexAllowedException(typeof(InvalidEnumArgumentException))]
  //  public DomainFactory CreateOfFactory_InstanceShouldBeNotNull(DomainFactory.eTypeEntity typeEntity)
  //  {
  //    var factory = DomainFactory.GetFactory(typeEntity);
  //    PexAssert.IsNotNull(factory, "Factory requested is null");

  //    return factory;
  //  }

  //  [PexMethod]
  //  public void CreateOfCthulhuFactory_InstanceShouldbeNotNull()
  //  {
  //    var factory = CreateOfFactory_InstanceShouldBeNotNull(DomainFactory.eTypeEntity.Cthulhu);
  //    PexAssert.IsInstanceOfType(factory, typeof(CthulhuFactory), "Istance is not of type requested");
  //  }

  //  [PexMethod]
  //  public void CthulhuIntesectPlayer_PlayerLifePointShouldBeDecreased()
  //  {
  //    // Arrange
  //    var time =new GameTimeAdapter(new GameTime(new TimeSpan(0, 0, 0, 10), new TimeSpan(0, 0, 0, 20)));
  //    var keys = new[] { Keys.Space };
  //    var pRecAdapter = new RectangleAdapter(0, 0, 300, 100);
  //    var mRecAdapter = new RectangleAdapter(0, 0, 300, 100);

  //    var Efactory = DomainFactory.GetFactory(DomainFactory.eTypeEntity.Cthulhu);
  //    var SutMatrix = new DomainEntityMatrix(Efactory, 3);
  //    var cManager = new ContentManagerAdapter(contentManager);
  //    SutMatrix.LoadContent(cManager, new RectangleAdapter(0, 0, 300, 280));

  //    var Pfactory = DomainFactory.GetFactory(DomainFactory.eTypeEntity.Player);
  //    var Pentity = Pfactory.CreateEntity(cManager);

  //    Pentity.Update(pRecAdapter, keys);
  //    Pentity.Move(pRecAdapter, keys);
  //    SutMatrix.Update(mRecAdapter, time);

  //    var TDamage = SutMatrix.Matrix[2, 2].Damage;
  //    Pentity.Position = SutMatrix.Matrix[2, 2].Position;
  //    var oldLP = Pentity.LifePoint;
  //    // ACT

  //    CollisionManager.DetectCollision(SutMatrix, Pentity);

  //    var newLP = Pentity.LifePoint;
  //    var diff = oldLP - newLP;
  //    // Assert
  //    Assert.IsTrue(diff == TDamage,"Life Point of Player is not decreased by Cthulhu Damage");
  //  }

  //}
}
